<template name="activities">
    <div class="js-sidebar-list-actions">
        {{# each board.activities }}
            <div class="phenom phenom-action clearfix phenom-other">
                {{> userAvatar user=user size="extra-small" class="creator js-show-mem-menu" }}
                <div class="phenom-desc">
                    {{ > memberName user=user }}

                    {{# if isTrue activityType 'createBoard' }}
                        {{_ 'activity-create-board'}}
                    {{ /if }}

                    {{# if isTrue activityType 'createList' }}
                        {{_ 'activity-create-list' listTitle=list.title }}
                    {{ /if }}

                    {{# if isTrue activityType 'archivedList' }}
                        {{_ 'activity-archive-list' listTitle=list.title }}
                    {{ /if }}

                    {{# if isTrue activityType 'createCard' }}
                        {{{_ 'activity-create-card'
                            cardLink=card.absoluteUrl
                            cardTitle=card.title
                            listTitle=list.title}}}
                    {{ /if }}

                    {{# if isTrue activityType 'archivedCard' }}
                        {{{_ 'activity-archive-card'
                            cardLink=card.absoluteUrl
                            cardTitle=card.title }}}
                    {{ /if }}

                    {{# if isTrue activityType 'restoredCard' }}
                        {{{_ 'activity-restore-card'
                            cardLink=card.absoluteUrl
                            cardTitle=card.title }}}
                    {{ /if }}

                    {{# if isTrue activityType 'moveCard' }}
                        {{{_ 'activity-move-card'
                            cardLink=card.absoluteUrl
                            cardTitle=card.title
                            oldListTitle=oldList.title
                            listTitle=list.title }}}
                    {{ /if }}

                    {{# if isTrue activityType 'addBoardMember' }}
                        added {{ > memberName user=member }} to this board.
                    {{ /if }}

                    {{# if isTrue activityType 'removeBoardMember' }}
                        excluded {{ > memberName user=member }} from this board.
                    {{ /if }}

                    {{# if isTrue activityType 'joinMember' }}
                        {{# if isTrue currentUser._id member._id }}
                            joined <a href="{{ card.absoluteUrl }}" class="action-card">{{ card.title }}</a>.
                        {{ else }}
                            added {{ > memberName user=member }} to <a href="{{ card.absoluteUrl }}" class="action-card">{{ card.title }}</a>.
                        {{/if}}
                    {{ /if }}

                    {{# if isTrue activityType 'unjoinMember' }}
                        {{# if isTrue currentUser._id member._id }}
                            unjoined <a href="{{ card.absoluteUrl }}" class="action-card">{{ card.title }}</a>.
                        {{ else }}
                            removed {{ > memberName user=member }} from <a href="{{ card.absoluteUrl }}" class="action-card">{{ card.title }}</a>.
                        {{/if}}
                    {{ /if }}

                    {{# if isTrue activityType 'addComment' }}
                        <div class="phenom-desc">
                            on <a href="{{ card.absoluteUrl }}" class="action-card">{{ card.title }}</a>
                            <div class="action-comment markeddown">
                                <a href="{{ card.absoluteUrl }}" class="current-comment show tdn">
                                    <p>{{#viewer}}{{ comment.text }}{{/viewer}}</p>
                                </a>
                            </div>
                        </div>
                    {{ /if }}

                    {{# if isTrue activityType 'addAttachment' }}
                        <div class="phenom-desc">
                            {{_ 'attached'}} <a href="{{ attachment.url }}" class="js-open-attachment-viewer">{{ attachment.name }}</a>
                            to <a href="{{ card.absoluteUrl }}" class="action-card">{{ card.title }}</a>
                        </div>
                    {{ /if }}
                </div>
                <p class="phenom-meta quiet">
                    <span class="date js-hide-on-sending">
                        {{ moment createdAt }}
                    </span>
                </p>
            </div>
        {{ /each }}
    </div>
</template>

<template name="cardActivities">
        <div class="js-list-actions">
            {{# each card.comments }}
                <div class="phenom phenom-action clearfix phenom-comment">
                    {{> userAvatar user=user size="small" class="creator js-show-mem-menu" }}
                    <form>
                        <div class="phenom-desc">
                            {{ > memberName user=user }}
                            <div class="action-comment markeddown">
                                <div class="current-comment">
                                  {{#viewer}}{{ text }}{{/viewer}}
                                </div>
                                <textarea class="js-text" tabindex="1">{{ text }}</textarea>
                            </div>
                        </div>
                        <div class="edit-controls clearfix">
                            <input type="submit" class="primary confirm js-save-edit" value="Save" tabindex="2">
                        </div>
                    </form>
                    <p class="phenom-meta quiet">
                        <span class="date js-hide-on-sending">{{ moment createdAt }}</span>
                        {{# if currentUser }}
                            <span class="js-hide-on-sending">
                                - <a href="#" class="js-edit-action">{{_ "edit"}}</a>
                                - <a href="#" class="js-confirm-delete-action">{{_ "delete"}}</a>
                            </span>
                        {{/ if }}
                    </p>
                </div>
            {{/each}}

            {{# each card.activities }}
                <div class="phenom phenom-action clearfix phenom-other">
                    {{> userAvatar user=user size="extra-small" class="creator js-show-mem-menu" }}
                    {{ > memberName user=user }}
                    {{# if isTrue activityType 'createCard' }}
                        added this card to {{ list.title }}.
                    {{ /if }}
                    {{# if isTrue activityType 'joinMember' }}
                        {{# if isTrue currentUser._id member._id }}
                            joined this card.
                        {{ else }}
                            added this card to {{ > memberName user=member }}.
                        {{/if}}
                    {{/if}}
                    {{# if isTrue activityType 'unjoinMember' }}
                        {{# if isTrue currentUser._id member._id }}
                            unjoined this card.
                        {{ else }}
                            removed this card from {{ > memberName user=member }}.
                        {{/if}}
                    {{ /if }}
                    {{# if isTrue activityType 'archivedCard' }}
                        archived this card.
                    {{ /if }}
                    {{# if isTrue activityType 'restoredCard' }}
                        sent this card to the board.
                    {{/ if }}
                    {{# if isTrue activityType 'moveCard' }}
                        moved this card from {{ oldList.title }} to {{ list.title }}.
                    {{/ if }}
                </div>
            {{/each}}
        </div>
</template>
